import { createPage } from '@mpxjs/core'

createPage({
  data: {
    showMask: false,
    showRule: false,
    title: '',
    checkValue: false,
    height: 0
  },
  onLoad() {
    const systemInfo = wx.getWindowInfo()
    const menuInfo = wx.getMenuButtonBoundingClientRect()
    this.setData({
      height: systemInfo.statusBarHeight + menuInfo.height
    })
  },

  // onReady() {},

  methods: {
    catch() {
      return null
    },
    triggerRule() {
      this.setData({
        showRule: !this.showRule,
        checkValue: true
      })
    },
    show() {
      if (!this.checkValue) {
        this.setData({
          showRule: true
        })
        return
      }
      this.setData({
        showMask: true,
        title: '选择互动方式'
      })
      const nav = this.selectComponent('.nav')
      console.log(nav)
      nav.setData({
        canPageBack: true
      })
    },
    pageBack() {
      this.setData({
        showMask: false,
        title: ''
      })
      const nav = this.selectComponent('.nav')
      console.log(nav)
      nav.setData({
        canPageBack: false
      })
    },
    goCityList() {
      wx.navigateTo({
        url: '../../pages/cityList/cityList'
      })
    },
    goAR() {
      wx.navigateTo({
        url: '../../pages/ar/ar'
      })
    },
    changeCheck() {
      this.setData({
        checkValue: !this.checkValue
      })
      console.log(this.checkValue)
    }
  }
})
